! Created by ZhaoYH on 2023/10/20.
include 'DataReader.f90'
include 'DataWriter.f90'

program DataIOTest
    use DataWriter
    use DataReader
    implicit none

    integer, parameter :: xdef = 73, ydef = 37, zdef = 11, tdef = 18, argc = 6
    integer :: i, j, k, t, arg
    real, allocatable :: new_array(:, :, :, :, :)
    real, allocatable :: data_array(:, :, :, :, :)

    

    rd_argc = argc
    rd_xdef = xdef
    rd_ydef = ydef
    rd_zdef = zdef
    rd_tdef = tdef
    allocate(data_array(rd_argc, rd_xdef, rd_ydef, rd_tdef, rd_zdef))
    call read_data("E:\Homework\Weather Diagnosis\EX01\data\2013vortex.grd", data_array)

    wd_argc = 2
    wd_xdef = xdef
    wd_ydef = ydef
    wd_zdef = zdef
    wd_tdef = tdef
    allocate(new_array(2, xdef, ydef, tdef, zdef))

    new_array(1:2, 1:xdef, 1:ydef, 1:tdef, 1:zdef) = data_array(4:5, 1:xdef, 1:ydef, 1:tdef, 1:zdef)

    call write_data ("E:\Homework\Weather Diagnosis\EX01\data\2013vortex_uv.grd", new_array)

end program DataIOTest